You are here: Statements and Functions > OwnedResource()
Syntax samples
OWNEDRESOURCE ({<expression >})
OWNEDRESOURCE (2)
OWNEDRESOURCE (ResQty())
OWNEDRESOURCE ()
Returns the name-index number of the nth resource currently owned by the entity or downtime making the function call. The function parameter indicates the position of the resource in the chronological list of owned resources. For example, OwnedResource(1) returns the longest owned resource in the list and so on.
When used without a parameter, this function returns the most recent resource that the entity captured and still owns. If the parameter value is not within the range of the resource list, or if the entity or downtime currently does not own a resource, the function will return a 0 (zero) without a warning or error message.
A preempted resource is NOT removed from the list but marked temporarily to indicate that the preemptee does not own the resource. After the resource resumes the original process after being preempted, it retains its original rank in the list.
Entity speed fields, traveling-time fields, resource fields, resource downtime logic, location processing logic, location downtime logic, routing fields, arrival logic, debug user-condition fields, and move logic.
Components
<expression>
The nth resource currently owned by the entity or downtime making the function call. When this parameter is not used, the function returns the last resource captured that is still owned by the entity.
Example
Suppose an entity owns two resources. The first resource was captured using the statement GET Worker. The second resource was captured using the statement GET Oper1 OR Oper2. We know the entity owns the resource Worker, but we do not know if the entity owns Oper1 or Oper2. It is time to release the second resource so we use the following logic:
FREE OWNEDRESOURCE()
RES(), GET, JOINTLY GET, USE, and FREE. Also see Resources.